package com.zhou.jiancai.activity;

import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.zhou.jiancai.R;
import com.zhou.jiancai.fragment.stepview.DrawCanvasFragment;
import com.zhou.jiancai.fragment.stepview.HorizontalStepviewFragment;
import com.zhou.jiancai.fragment.stepview.VerticalStepViewFrowardFragment;
import com.zhou.jiancai.fragment.stepview.VerticalStepViewReverseFragment;

/**
 * Created by Administrator on 2017/6/27.
 */

public class StepViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.stepview_activity);
    Button h= (Button) findViewById(R.id.but_stepview_h);
    Button v= (Button) findViewById(R.id.but_stepview_v);
        h.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i=new Intent(StepViewActivity.this,HorizontalStepviewActivity.class);
                startActivity(i);

            }
        });
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i=new Intent(StepViewActivity.this,VerticalStepViewActivity.class);
                startActivity(i);
            }
        });






    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_stepview,menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        VerticalStepViewReverseFragment mVerticalStepViewFragment;
        DrawCanvasFragment mDrawCanvasFragment;
        HorizontalStepviewFragment mHorizontalStepviewFragment;
        VerticalStepViewFrowardFragment mVerticalStepViewReverseFragment;
        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        int itemId = item.getItemId();
        switch(itemId)
        {
            case R.id.action_edit:
                mHorizontalStepviewFragment = new HorizontalStepviewFragment();
                fragmentTransaction.replace(R.id.container_1, mHorizontalStepviewFragment).commit();
                break;

            case R.id.action_edit1:
                mDrawCanvasFragment = new DrawCanvasFragment();
                fragmentTransaction.replace(R.id.container_1, mDrawCanvasFragment).commit();
                break;
            case R.id.action_edit2:
                mVerticalStepViewFragment = new VerticalStepViewReverseFragment();
                fragmentTransaction.replace(R.id.container_1, mVerticalStepViewFragment).commit();
                break;

            case R.id.action_edit3:
                mVerticalStepViewReverseFragment = new VerticalStepViewFrowardFragment();
                fragmentTransaction.replace(R.id.container_1, mVerticalStepViewReverseFragment).commit();
                break;





        }



        return super.onOptionsItemSelected(item);
    }
}
